<?php

namespace App\Models;

use App\Enums\MemberBalanceType;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class MemberMoneyLog extends Model
{
    use HasFactory, SoftDeletes;

    protected $fillable = [
        'member_id', 'user_id', 'store_id', 'money', 'out_id', 'content',
        'channel', 'type', 'give_money',
        'before_money', 'after_money', 'balance_type',
    ];

    protected $casts = [
        'balance_type' => MemberBalanceType::class,
    ];

    public function member()
    {
        return $this->belongsTo(Member::class);
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function store()
    {
        return $this->belongsTo(Store::class);
    }

//    public function order()
//    {
//        return $this->belongsTo(Order::class, 'out_id');
//    }
}
